#include<vector>
#include<iostream>
#include<string>
#include<stack>
#include<algorithm>
using namespace std;
class MinStack {
public:
    stack<int> _stack;
    stack<int> min_stack;
    MinStack() {

    }

    void push(int val) {
        _stack.push(val);
        if (min_stack.empty()) {
            min_stack.push(val);
        }
        else if (min_stack.top() >= val) {
            min_stack.push(val);
        }

    }

    void pop() {

        if (_stack.top() == min_stack.top()) {
            min_stack.pop();
        }
        _stack.pop();

    }

    int top() {
        return _stack.top();

    }

    int getMin() {
        return min_stack.top();

    }
};

//int main() 
//{
//    MinStack ms;
//    //ms.push(-2);
//    //ms.push(0);
//    //ms.push(-3);
//    //ms.push(-100);
//    //ms.push(-1024);
//    //ms.push(1000);
//    cout << ms.getMin();
//    return  0;
//}